﻿using System;

namespace RaceList.Admin.Relay
{
    public partial class SponsorAdd : System.Web.UI.Page
    {
        ipowdb_suibian_webDataContext db = ConnHelper.ipowdb_suibian_web();

        /// <summary>
        /// 保存信息
        /// </summary>
        /// <para nae="sender"></para>
        /// <para nae="e"></para>
        protected void btnSave_Click(object sender, EventArgs e)
        {
            string Message = string.Empty;
            Activity_Sponsor sponsor = new Activity_Sponsor
            {
                addTime = DateTime.Now,
                editTime = DateTime.Now,
                Name = txtName.Text.Trim(),
                status = CommonHelp.GetStatus(ddl1.SelectedIndex),
            };
            try
            {
                db.Activity_Sponsor.InsertOnSubmit(sponsor);
                db.SubmitChanges();
                //.AddOperatingLog("活动", "添加", "添加了活动 ID:" + sponsor.Id + ",Title:" + sponsor.title);
                StringHelper.Alert(this, "赞助商发布成功！", "SponsorList.aspx");
            }
            catch (Exception ex)
            {
                //.AddErrorLog(ex);
                this.Message.Text = "发布失败! 失败原因：" + ex.Message + "。详细错误信息请查看错误日志。";
            }
        }
    }
}